/**
  CNOK project, Anyang Normal University, IMP-CAS
  \class TARandom
  \brief Numerical results of Bessel and modified Bessel functions of integer
  order. Note that this class is a mathematical tool class.
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2022/12/02
  \date Last modified: 2022/12/02 by SUN Yazhou
  \copyright 2020-2023 SUN Yazhou
  \copyright CNOK project, Anyang Normal University, IMP-CAS
*/

#include "TARandom.h"

TARandom::TARandom(){
  fmt.seed(frd());
}

// s=0, set to frd()
void TARandom::SetSeed(unsigned s){
  if(9999 == s) fmt.seed(frd());
  fmt.seed(s);
} // end member function SetSeed

TARandom::~TARandom(){}

double TARandom::Uniform(double x1, double x2){
  std::uniform_real_distribution<double> u(x1, x2);
  return u(fmt);
} // end member function Uniform

double TARandom::Gaus(double mean, double sigma){
  std::normal_distribution<double> n(mean, sigma);
  return n(fmt);
} // end member function Gaus

int TARandom::Binomial(int ntot, double prob){
  std::binomial_distribution<int> b(ntot, prob);
  return b(fmt);
} // end member function Binomial
